GARNAME = bluez
GARVERSION = 5.50
CATEGORIES = lib
MASTER_SITES = http://www.kernel.org/pub/linux/bluetooth/
DISTFILES = $(DISTNAME).tar.gz
PATCHFILES = $(DISTNAME)-fix-build-kernel-5.2.patch
LICENSE = GPL2

DESCRIPTION =
define BLURB
endef

DEPENDS  = lang/c gtk/glib lib/alsa-lib lib/dbus lib/readline
ifneq ($(DESTIMG),build)
DEPENDS += lib/libusb-compat system/eudev
endif

CONFIGURE_SCRIPTS = $(WORKSRC)/configure
BUILD_SCRIPTS     = $(WORKSRC)/Makefile
INSTALL_SCRIPTS   = $(WORKSRC)/Makefile

CONFIGURE_ARGS  = $(DIRPATHS) --build=$(GARBUILD) --host=$(GARHOST) \
	--disable-silent-rules \
	--disable-static \
	--enable-shared \
	--enable-optimization \
	--disable-pie \
	--disable-nfc \
	--disable-sap \
	--enable-a2dp \
	--enable-avrcp \
	--disable-network \
	--enable-hid \
	--enable-hog \
	--disable-health \
	--enable-tools \
	--enable-monitor \
	--disable-udev \
	--disable-cups \
	--disable-mesh \
	--disable-midi \
	--disable-obex \
	--disable-btpclient \
	--enable-client \
	--disable-systemd \
	--disable-datafiles \
	--disable-manpages \
	--disable-testing \
	--enable-experimental \
	--enable-deprecated \
	--disable-sixaxis \
	--disable-logger \
	--disable-android \
	--disable-debug \
	--disable-attrib \
	--with-gnu-ld

ifeq ($(DESTIMG),build)
CONFIGURE_ARGS += \
	--disable-usb
else
CONFIGURE_ARGS += \
	--enable-usb
endif

include ../../gar.mk

pre-configure:
	@$(call RUN_AUTOTOOLS)
	@$(call FIX_LIBTOOL,$(WORKSRC)/configure)
	@$(MAKECOOKIE)

post-install:
	@rm -f $(DESTDIR)$(libdir)/alsa-lib/libasound_module_ctl_bluetooth.la
	@rm -f $(DESTDIR)$(libdir)/alsa-lib/libasound_module_pcm_bluetooth.la
	@rm -f $(DESTDIR)$(libdir)/libbluetooth.la
	@$(MAKECOOKIE)
